/**
 *
 */
package com.ybkj.daijia.server.service.impl;


import com.ybkj.daijia.page.Page;
import com.ybkj.daijia.page.Pageable;
import com.ybkj.daijia.page.impl.PageImpl;
import com.ybkj.daijia.page.impl.PageRequest;
import com.ybkj.daijia.server.mapper.WeixinManagerPaymentsMapper;
import com.ybkj.daijia.server.model.WeixinManagerPayments;
import com.ybkj.daijia.server.service.WeixinManagerPaymentsService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Shine
 *
 */
@Service
public class DefaultWeixinManagerPaymentsService implements WeixinManagerPaymentsService {

    @Autowired
    private WeixinManagerPaymentsMapper weixinManagerPaymentsMapper;


    @Override
    public Page<WeixinManagerPayments> queryByManagerId(Long managerId, Integer page,
        Integer limit) {

        Pageable pageable = new PageRequest(page, limit);

        List<WeixinManagerPayments> content = weixinManagerPaymentsMapper
            .selectByManagerId(managerId, page * limit, limit);
        long total = weixinManagerPaymentsMapper.countByManagerId(managerId);

        return new PageImpl<WeixinManagerPayments>(content, pageable, total);
    }


}